package org.example.qqrobot.controller.user;

import lombok.extern.slf4j.Slf4j;
import org.example.qqrobot.model.Result;
import org.example.qqrobot.model.vo.MessageIntoPageVO;
import org.example.qqrobot.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user/message")
@Slf4j
public class MessageController {
    @Autowired
    private MessageService messageService;

    @GetMapping("/intoPage")
    public Result intoPage(Long id){
        log.info("进入消息页面，{}",id);
        MessageIntoPageVO messageIntoPageVO = messageService.intoPage(id);
        return Result.success(messageIntoPageVO);
    }

    @PostMapping("/already")
    private Result already(Long id) {
        log.info("消息已读，{}", id);
        messageService.already(id);
        return Result.success();
    }
}
